<template>
	<view >
		<view class="tie" >
			<view class="tie1" @click="click==true?jump('/pages/tie/view?id='+item.id):''">
				<view><u-avatar :src="item.avatarUrl" mode="circle"></u-avatar></view>
			    <view class="tie1_right">
					<view class="name">{{item.realname}}</view>
					<view class="time">{{item.time}}</view>
				</view>
			</view>
			<view class="tie2" @click="click==true?jump('/pages/tie/view?id='+item.id):''">{{item.content}}</view>
			<view class="tie3" v-if="item.imgs">
				
				<block  v-if="item.imgs.length>1">
				<image 
				v-for="(item1,index1) in item.imgs" 
				:key="index1"
				mode="aspectFill"
				@tap.stop="previewImage(item.imgs,index1)"
				:src="item1"></image>
				</block>
				<block  v-else>
					<image
					class="img100"
					v-for="(item1,index1) in item.imgs" 
					:key="index1"
					mode="aspectFill"
					@tap.stop="previewImage(item.imgs,index1)"
					:src="item1"></image>
					
				</block>
				
			</view>
			<view class="tie4" >
				<view class="share" @click="share">
					<button class="share-now" open-type="share"><u-icon name="share" color="#999" size="38"></u-icon><text class="title4">分享</text></button>
					
					
					</view>
				<view class="comment"  @click="click==true?jump('/pages/tie/view?id='+item.id):''">
					<u-icon name="chat" color="#999" size="40"></u-icon>
					<view class="title4">{{item.plcount}}</view>
				</view>
				<view class="fav" @tap.stop="fav_act(item.id)">
					
					<u-icon v-if="fav==1" name="heart" color="red" size="40"></u-icon>
					<u-icon v-else name="heart" color="#999" size="40"></u-icon>
				   
				</view>
				
			</view>
			
		</view>
		
		<view class="kg" style="margin-left: -20rpx; margin-right: -20rpx;"></view>
	</view>
</template>

<script>
	export default {
		props: {
			item: {
				type:Object,
				default: {}
			},
			click: {
				type:Boolean,
				default: true
			}
		
		},
		name:"tie",
		data() {
			return {
				fav:0
			};
		},
		mounted:function(){
		    this.fav=this.item.fav
	
		},
		methods:{
		
			fav_act(id){
			   let user=uni.getStorageSync("user");
			   this.$u.post('index.php?class=fav&act=addedi', {
			   	tieid: id,
				uid:user.id
			   }).then(res => {
			   	if (res.code == 0) {
			   		if (res.msg=="add"){
						this.fav=1
					
					} else{
				
						this.fav=0
					}
					  
					   
					console.log(this.item,2222)
			   	} else {
			   		this.msg(res.msg)
			   	}
			   
			   });
			}
		}
	}
</script>

<style scoped>
	.share-now::after{ border: none; }
	.share-now{border:0px; background-color: white;background: none; font-size: 14px;}
 .tie1{display: flex;}
 .tie{ margin: 20rpx auto;}
 .tie1_right{ margin-left: 10px; display: flex; flex-direction: column; justify-content: center;}
 .name{font-size: 32rpx; margin-bottom: 10rpx;}
 .time{font-size: 20rpx; color: #999;}
 .tie2{ margin: 20rpx auto; line-height: 25px; font-size: 28rpx;}
 .tie3{display: flex;flex-wrap: wrap; }
 .tie3 image{width: 31%; border-radius: 10rpx; height: 220rpx; padding: 1%;}
 .tie3 .img100{width: 100%; border-radius: 10rpx; height: 500rpx; }
 .tie4{display: flex; justify-content: space-between; margin-top:40rpx}
 .share,.comment,.fav{display: flex;align-items: center;justify-content:center; width: 250rpx;}
 .title4{padding-left: 10rpx;}
</style>
